/*
 * MsgQue.h
 * For Context source use only, Mainly for send.
 *  Created on: 2008-10-13
 *      Author: root
 */

#ifndef MSGQUE_H_
#define MSGQUE_H_

#include <sys/types.h>

static const int MBUFSIZ = 2048;

struct MsgType
{
	long mtype;				/* message type, must be > 0 */
//	int msrc;	/* where the msg belongs to, 0: msgqueue; 1: socket */
	char mtext[MBUFSIZ];	/* message data */
};

class MsgQue
{
	char keyword[256];
	key_t key;
	int queId;
	int ownerMode;

public:
	// get a MsgQue, mode = 0: if exist, return it, else if mode = 1, delete it and re-create a new one
	MsgQue(char *keywords, int mode);
	~MsgQue();
	int send(long type, const char *msg);
};

#endif /* MSGQUE_H_ */

